<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .container {
            width: 800px;
            height: 120px;
            margin: 50px auto;
            border: 1px solid #ccc;
            position: relative;
        }

        ul {
            list-style: none;
            width: 1240px;
        }

        ul li {
            float: left;
            padding: 0px 7px;
        }

        img {
            width: 110px;
            height: 50px;
        }

        .imgs {
            width: 620px;
            margin: 40px auto;
            overflow: hidden;
        }

        .icon div {
            width: 50px;
            height: 50px;
            line-height: 50px;
            position: absolute;
            top: 35px;
            font-size: 36px;
            background-color: #ccc;
            color: #333;
            text-align: center;
        }

        .icon .left {
            left: 0;
        }

        .icon .right {
            right: 0;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="imgs">

            <ul>
                <li><img src="images/fr-logo-01.gif" alt=""></li>
                <li><img src="images/fr-logo-02.gif" alt=""></li>
                <li><img src="images/fr-logo-03.gif" alt=""></li>
                <li><img src="images/fr-logo-04.gif" alt=""></li>
                <li><img src="images/fr-logo-05.gif" alt=""></li>
                <li><img src="images/fr-logo-06.gif" alt=""></li>
                <li><img src="images/fr-logo-07.jpg" alt=""></li>
                <li><img src="images/fr-logo-08.jpg" alt=""></li>
            </ul>
        </div>
        <div class="icon">
            <div class="left">&lt</div>
            <div class="right">&gt</div>
        </div>
    </div>
    <script src="js/jquery1.7.js"></script>
    <script>
        var num = 3;
        var width = $("ul li").first().innerWidth();
        $(".icon div").click(function () {
            if ($(this).index() == 0) {
                //左侧
                $("ul").css({
                    "marginLeft": -3 * width
                });
                $("ul li").slice(-num).prependTo($("ul"));
                $("ul").animate({
                    "marginLeft": 0
                });

            } else {
                //右侧
                
                $("ul").animate({marginLeft:-3*width},function(){
                  $("ul li").slice(0,num).appendTo($("ul"));
                  $("ul").css({marginLeft:0})
                })

            }
        })

    </script>
</body>

</html>